package com.fancy.learncenter.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.fancy.learncenter.activity.GoodsDetailActivity;
import com.fancy.learncenter.activity.TrainApplyDetailActivity;
import com.fancy.learncenter.adapter.base.CommonRecycleViewAdapter;
import com.fancy.learncenter.adapter.base.CustomViewHold;
import com.fancy.learncenter.bean.CollectDataBean;
import com.fancy.learncenter.bean.GoodsDataBean;
import com.superservice.lya.R;

import java.util.ArrayList;

/**
 * Created by hyy on 2018/1/27.
 * Explain activity as
 */

public class ToothCollectGoodsAdapter extends CommonRecycleViewAdapter<CollectDataBean> {

    public ToothCollectGoodsAdapter(Context mContext, ArrayList<CollectDataBean> itemDatas) {
        super(mContext, R.layout.activity_unused_goods_item, itemDatas);
    }

    @Override
    public void bindView(CustomViewHold customViewHold, final CollectDataBean item, int position) {
        SimpleDraweeView simpleDraweeView = customViewHold.getView(R.id.simpleDraweeView);
        simpleDraweeView.setImageURI(item.getMain_img());

        TextView textView = customViewHold.getView(R.id.title);
        textView.setText(item.getTitle());

        TextView price = customViewHold.getView(R.id.price);
        price.setText(item.getPrice());

        TextView location = customViewHold.getView(R.id.location);
        location.setText(item.getArea());

        TextView view_num = customViewHold.getView(R.id.view_num);
        view_num.setText(item.getComment_num() + "人评论");

        customViewHold.getRoorView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(mContext, GoodsDetailActivity.class);
                intent.putExtra("GoodsDataBean", item.getId() + "");
                mContext.startActivity(intent);
            }
        });

    }
}
